//
//  CameraConfigureHandle.h
//  WifiCamera
//
//  Created by jinbo on 2021/3/31.
//

#import <Foundation/Foundation.h>

#define CameraConfigureShareHandle [CMConfigureHandle shareHandle]
#define IFSCameraConfigureShareHandle CameraConfigureShareHandle
#define CMConfigureShareHandle CameraConfigureShareHandle
@class CMConfigureHandle, CMConfigureVerify;
typedef CMConfigureHandle CameraConfigureHandle;
typedef CMConfigureVerify CameraConfigureVerify;

@interface CMConfigureHandle : NSObject

+ (instancetype)shareHandle;

#pragma mark - 底层相关
/// 指定IP
@property (nonatomic, copy) NSString *ip;
/// 指定端口, USB 直连一般设置为 1004
@property (nonatomic, copy) NSString *port;

#pragma mark - 校验
/// 产商 型号 支持, 未设置,则所有设备可使用
@property (nonatomic, strong) NSArray<CMConfigureVerify *> *verifyManufactorys;

/// 跳过License校验, 设置为YES, 将对所有设备不校验License
@property (nonatomic, assign) BOOL ignoreAllCheckLicense;

/// 跳过License校验的型号, 将不会校验这些型号的License, 未设置,则校验所有型号
@property (nonatomic, strong) NSArray<CMConfigureVerify *> * verifyIgnoreLicense;

/// 已连接设备但是没有License 是否继续正常流程
@property (nonatomic, assign) BOOL connectedAndNoLicenceButContinue;

/// License校验失败,但是继续进行的设备, 未设置,则license错误后, 不可继续
@property (nonatomic, strong) NSArray<CMConfigureVerify *> * verifyLicenseErrorButContinue;

/// 支持的SSID前缀, 如果设置此值,则不是该值范围内的设备,将不会上线, 只有支持获取设备SSID的模块支持, 例如BKWIFI, I4WIFI
@property (nonatomic, strong) NSArray<NSString *> *supportSSIDPrefix;

#pragma mark - 图像校正
/// 自动调整角度偏移(读取flash值进行校正), 默认YES
@property (nonatomic, assign) BOOL autoAdjustAngleOffset;

/// 设置调整角度偏移固定值, 注意 isValid 需要设置为YES
//@property (nonatomic, assign) ImageAdjustAngleOffset adjustAngleOffset;
@property (nonatomic, strong) CMAdjustAngleInfo *adjustAngleInfo;

/// 支持的MFI协议
@property (nonatomic, strong) NSString *mfiProtocol;

/// MFI 自动 opensession, 默认YES
@property (nonatomic, assign) BOOL mfiAutoOpensession;

/// 掉线重置滤镜参数, 默认YES
@property (nonatomic, assign) BOOL imageFilterResetWhenDisconnect;

/// 四季库初始化为存储方案
@property (nonatomic, assign) BOOL isSJStorage;

/// 乐信缩放按键的模式
@property (nonatomic, assign) CMLexinScaleMode lxScaleMode;
#pragma mark - License 1.5
/// 设置为YES,则当前进程所有设备支持1.5校验, 且lic15ModelName将无效
@property (nonatomic, assign) BOOL lic15SupportAll;
/// 设置某一些支持1.5的设备型号
@property (nonatomic, strong) NSArray<DeviceProperty> *lic15SupportModelName;
/// 防伪
@property (nonatomic, assign) BOOL checkPiracy;

/// 忽略休眠 (zCamera)
@property (nonatomic, assign) BOOL ignoreSleepCamera;

/// 蓝牙辅助连接 bkcamera
@property (nonatomic, assign) BOOL bluetoothAssistance;
#pragma mark - 拍照录制
/// 保存拍照差值
//@property (nonatomic, assign) CGSize saveToSize DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");

/// 保存录制差值
//@property (nonatomic, assign) CGSize recordToSize DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");

/// 是否原图录制
@property (nonatomic, assign) BOOL recordUseOriginImage;// DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");

/// 保存拍照录制到系统相簿
//@property (nonatomic, assign) BOOL isSaveToSystemAlbum DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");

/// 保存到系统相簿名称
//@property (nonatomic, copy) NSString *saveToSystemAlbumName DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");

/// 保存到本地目录
//@property (nonatomic, copy) NSString *saveToLocalDirectory DEPRECATED_MSG_ATTRIBUTE("use CMRecordHandle.share");

/// 云文件保存目录
@property (nonatomic, copy) NSString *cloudFileSaveFolder;

/// 调试参数
/// VideoFormat: 0:YUV420 1:YUV422 3:NV12 4:MJPEG
/// Resolution: 图像分辨率
/// Headersize: 数据包头大小
/// SaveToLocal: 不含头未解析的数据存本地
@property (nonatomic, strong) NSMutableDictionary *debugParseConfigure;

@end

/// 厂商限制 License限制
@interface CMConfigureVerify : NSObject

/// 厂商  未设置则不限制
@property (nonatomic, strong) DeviceProperty manufactory;

/// 型号  未设置则不限制
@property (nonatomic, strong) NSArray<DeviceProperty> * modelNames;

/// 型号前缀匹配  未设置则不限制
@property (nonatomic, strong) NSArray<DeviceProperty> * modelNamePrefixs;

/// 指定的连接类型  未设置则不限制
@property (nonatomic, assign) CMConnectType connectType;

/// 创建一个校验的信息
/// @param manufactory 厂商
/// @param modelNames 型号
+ (instancetype)verifyManufactory:(DeviceProperty)manufactory
                       modelNames:(NSArray<DeviceProperty> *)modelNames;

/// 创建一个校验的信息
/// @param manufactory 厂商
/// @param modelNames 型号
/// @param modelNamePrefixs 型号前缀匹配
+ (instancetype)verifyManufactory:(DeviceProperty)manufactory
                       modelNames:(NSArray<DeviceProperty> *)modelNames
                 modelNamePrefixs:(NSArray<DeviceProperty> *)modelNamePrefixs;

/// 创建一个校验的信息
/// @param manufactory 厂商
/// @param modelNames 型号
/// @param connectType 指定的连接类型
+ (instancetype)verifyManufactory:(DeviceProperty)manufactory
                       modelNames:(NSArray<DeviceProperty> *)modelNames
                      connectType:(CMConnectType)connectType;

@end

